home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / CodeWarrior Lite / Metrowerks C⁄C++ Lite / Headers / Universal Headers 2.0.1f / Aliases.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-22  |  5.9 KB  |  161 lines  |  [TEXT/MMCC]

  1. /*
  2.      File:        Aliases.h
  3.  
  4.      Contains:    Alias Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.0 in “MPW Latest” on ETO #17
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __ALIASES__
  21. #define __ALIASES__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifndef __APPLETALK__
  30. #include <AppleTalk.h>
  31. #endif
  32. /*    #include <OSUtils.h>                                        */
  33. /*        #include <MixedMode.h>                                    */
  34. /*        #include <Memory.h>                                        */
  35.  
  36. #ifndef __FILES__
  37. #include <Files.h>
  38. #endif
  39.  
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43.  
  44. #if PRAGMA_ALIGN_SUPPORTED
  45. #pragma options align=mac68k
  46. #endif
  47.  
  48. #if PRAGMA_IMPORT_SUPPORTED
  49. #pragma import on
  50. #endif
  51.  
  52.  
  53. enum {
  54.     rAliasType                    = 'alis',                        /* Aliases are stored as resources of this type */
  55. /* define alias resolution action rules mask */
  56.     kARMMountVol                = 0x00000001,                    /* mount the volume automatically */
  57.     kARMNoUI                    = 0x00000002,                    /* no user interface allowed during resolution */
  58.     kARMMultVols                = 0x00000008,                    /* search on multiple volumes */
  59.     kARMSearch                    = 0x00000100,                    /* search quickly */
  60.     kARMSearchMore                = 0x00000200,                    /* search further */
  61.     kARMSearchRelFirst            = 0x00000400,                    /* search target on a relative path first */
  62. /* define alias record information types */
  63.     asiZoneName                    = -3,                            /* get zone name */
  64.     asiServerName                = -2,                            /* get server name */
  65.     asiVolumeName                = -1,                            /* get volume name */
  66.     asiAliasName                = 0,                            /* get aliased file/folder/volume name */
  67.     asiParentName                = 1                                /* get parent folder name */
  68. };
  69.  
  70. /* define the alias record that will be the blackbox for the caller */
  71. struct AliasRecord {
  72.     OSType                            userType;                    /* appl stored type like creator type */
  73.     unsigned short                    aliasSize;                    /* alias record size in bytes, for appl usage */
  74. };
  75. typedef struct AliasRecord AliasRecord;
  76.  
  77. typedef AliasRecord *AliasPtr, **AliasHandle;
  78.  
  79. /* alias record information type */
  80. typedef short AliasInfoType;
  81.  
  82. typedef pascal Boolean (*AliasFilterProcPtr)(CInfoPBPtr cpbPtr, Boolean *quitFlag, Ptr myDataPtr);
  83.  
  84. #if GENERATINGCFM
  85. typedef UniversalProcPtr AliasFilterUPP;
  86. #else
  87. typedef AliasFilterProcPtr AliasFilterUPP;
  88. #endif
  89.  
  90. enum {
  91.     uppAliasFilterProcInfo = kPascalStackBased
  92.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  93.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(CInfoPBPtr)))
  94.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Boolean*)))
  95.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Ptr)))
  96. };
  97.  
  98. #if GENERATINGCFM
  99. #define NewAliasFilterProc(userRoutine)        \
  100.         (AliasFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppAliasFilterProcInfo, GetCurrentArchitecture())
  101. #else
  102. #define NewAliasFilterProc(userRoutine)        \
  103.         ((AliasFilterUPP) (userRoutine))
  104. #endif
  105.  
  106. #if GENERATINGCFM
  107. #define CallAliasFilterProc(userRoutine, cpbPtr, quitFlag, myDataPtr)        \
  108.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppAliasFilterProcInfo, (cpbPtr), (quitFlag), (myDataPtr))
  109. #else
  110. #define CallAliasFilterProc(userRoutine, cpbPtr, quitFlag, myDataPtr)        \
  111.         (*(userRoutine))((cpbPtr), (quitFlag), (myDataPtr))
  112. #endif
  113.  
  114. extern pascal OSErr NewAlias(ConstFSSpecPtr fromFile, const FSSpec *target, AliasHandle *alias)
  115.  TWOWORDINLINE(0x7002, 0xA823);
  116. /* create a minimal new alias for a target and return alias record handle */
  117. extern pascal OSErr NewAliasMinimal(const FSSpec *target, AliasHandle *alias)
  118.  TWOWORDINLINE(0x7008, 0xA823);
  119. /* create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle  */
  120. extern pascal OSErr NewAliasMinimalFromFullPath(short fullPathLength, const void *fullPath, ConstStr32Param zoneName, ConstStr31Param serverName, AliasHandle *alias)
  121.  TWOWORDINLINE(0x7009, 0xA823);
  122. /* given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag. */
  123. extern pascal OSErr ResolveAlias(ConstFSSpecPtr fromFile, AliasHandle alias, FSSpec *target, Boolean *wasChanged)
  124.  TWOWORDINLINE(0x7003, 0xA823);
  125. /* given an alias handle and an index specifying requested alias information type, return the information from alias record as a string. */
  126. extern pascal OSErr GetAliasInfo(AliasHandle alias, AliasInfoType index, Str63 theString)
  127.  TWOWORDINLINE(0x7007, 0xA823);
  128. /* 
  129.   Given a file spec, return target file spec if input file spec is an alias.
  130.   It resolves the entire alias chain or one step of the chain.  It returns
  131.   info about whether the target is a folder or file; and whether the input
  132.   file spec was an alias or not. 
  133. */
  134. extern pascal OSErr ResolveAliasFile(FSSpec *theSpec, Boolean resolveAliasChains, Boolean *targetIsFolder, Boolean *wasAliased)
  135.  TWOWORDINLINE(0x700C, 0xA823);
  136. extern pascal OSErr FollowFinderAlias(ConstFSSpecPtr fromFile, AliasHandle alias, Boolean logon, FSSpec *target, Boolean *wasChanged)
  137.  TWOWORDINLINE(0x700F, 0xA823);
  138. /* 
  139.    Low Level Routines 
  140.  Given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag
  141. */
  142. extern pascal OSErr MatchAlias(ConstFSSpecPtr fromFile, unsigned long rulesMask, AliasHandle alias, short *aliasCount, FSSpecArrayPtr aliasList, Boolean *needsUpdate, AliasFilterUPP aliasFilter, void *yourDataPtr)
  143.  TWOWORDINLINE(0x7005, 0xA823);
  144. /* given a fromFile-target pair and an alias handle, update the lias record pointed to by alias handle to represent target as the new alias. */
  145. extern pascal OSErr UpdateAlias(ConstFSSpecPtr fromFile, const FSSpec *target, AliasHandle alias, Boolean *wasChanged)
  146.  TWOWORDINLINE(0x7006, 0xA823);
  147.  
  148. #if PRAGMA_IMPORT_SUPPORTED
  149. #pragma import off
  150. #endif
  151.  
  152. #if PRAGMA_ALIGN_SUPPORTED
  153. #pragma options align=reset
  154. #endif
  155.  
  156. #ifdef __cplusplus
  157. }
  158. #endif
  159.  
  160. #endif /* __ALIASES__ */
  161.